﻿var lightBoxSettings = {
    imageLoading: '/views/styles/jquery/jquery.lightbox/lightbox-ico-loading.gif',
    imageBtnClose: '/views/styles/jquery/jquery.lightbox/lightbox-btn-close.png',
    imageBtnPrev: '/views/styles/jquery/jquery.lightbox/lightbox-btn-prev.png',
    imageBtnNext: '/views/styles/jquery/jquery.lightbox/lightbox-btn-next.png',
    imageBlank: '/views/styles/jquery/jquery.lightbox/lightbox-blank.gif',
    imageError: '/views/styles/jquery/jquery.lightbox/lightbox-error.png'
};

function showLightBox(url, width, height, callback) {
    if (!url) return false;
    $lightBox($('<a/>').attr('href', url).attr('lightbox-width', width || 'auto').attr('lightbox-height', height || 'auto'), { callback: callback });
    top.scrollTo(0, 200);
    return true;
}

function popupWindow(url, width, height) {
    var win = window.open(url, 'new', 'toolbars=no, resizeable=yes,status=no, menus=no');
    win.resizeTo(width, height);
}

function closeLightBox(data) {
    var close = window.lightBoxClose || (frameElement ? frameElement.lightBoxCallback : null) || parent.lightBoxClose;
    if (close) close(data);
}

(function () {
    if (frameElement != null && $(frameElement).attr('auto-resize') == 'true') {
        $(function () {
            var initHeight = document.body.scrollHeight;
            setTimeout(function () {
                if (document.body.scrollHeight > $(frameElement).height()) {
                    $(frameElement).height(document.body.scrollHeight);
                }
                setTimeout(arguments.callee, 300);
            }, 300);
        });
    }
})();